package com.cx.controller;

import com.cx.entity.Dept;
import com.cx.service.DeptService;
import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.stereotype.Service;

import java.util.List;
@Data
@Controller

public class ControllerImpl {
   @Autowired
   private DeptService deptService;

    public List<Dept> selectAllDept() {
        return deptService.selectAllDept();
    }


    public Dept selectDeptById(int id) {
        return deptService.selectDeptById(id);
    }


    public String deleteDept(int id) {
        return deptService.deleteDept(id) ? "删除成功" : "删除失败";

    }


    public String insertDept(Dept dept) {
        return deptService.insertDept(dept) ? "新增成功" : "新增失败";
    }


    public String updateDept(Dept dept) {
        return deptService.updateDept(dept) ? "修改成功" : "修改失败";
    }
}
